package com.xt.purchasingsystem.controller.productDesign.proFileManagement.proFileDelManagement;

import com.xt.purchasingsystem.dto.DFileDto;
import com.xt.purchasingsystem.service.productDesignService.proFileManageService.proFileDelManageService.ProductFileDelManageService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping(value = "/productFileDelManage")
public class ProductFileDelManageController {
    @Autowired
    private ProductFileDelManageService productFileDelManageService;

    /**
     * 多条件分页查询未删除的产品档案的接口
     * @param dFileDto
     * @return
     */
    @PostMapping("/queryDfileByHaveDelAndDto")
    public Result queryDfileByHaveDelAndDto(@RequestBody DFileDto dFileDto){
        return productFileDelManageService.queryDfileByHaveDelAndDto(dFileDto);
    }

    /**
     * 删除产品档案的接口
     * @param id
     * @return
     */
    @PutMapping("/deleteDfileByID/{id}")
    public Result deleteDfileByID(@PathVariable("id") Integer id){
        return productFileDelManageService.deleteDFileById(id);
    }


    /**
     * 多条件分页查询已删除的产品档案的接口
     * @param dFileDto
     * @return
     */
    @PostMapping("/queryDfileByDelRecoveryAndDto")
    public Result queryDfileByDelRecoveryAndDto(@RequestBody DFileDto dFileDto){
        return productFileDelManageService.queryDfileByDelRecoveryAndDto(dFileDto);
    }

    /**
     * 恢复产品档案的接口
     * @param id
     * @return
     */
    @PutMapping("/recoverDfileByID/{id}")
    public Result recoverDfileByID(@PathVariable("id") Integer id){
        return productFileDelManageService.recoverDFileById(id);
    }


    /**
     * 分页查询已删除的产品档案的接口
     * @param dFileDto
     * @return
     */
    @PostMapping("/queryDfileByPermanentDeleteAndDto")
    public Result queryDfileByPermanentDeleteAndDto(@RequestBody DFileDto dFileDto){
        return productFileDelManageService.queryDfileByPermanentDeleteAndDto(dFileDto);
    }

    /**
     * 永久删除产品档案的接口
     * @param id
     * @return
     */
    @DeleteMapping("/PermanentDeleteDfileById/{id}")
    public Result PermanentDeleteDfileById(@PathVariable("id") Integer id){
       return  productFileDelManageService.permanentDelDFile(id);
    }


}
